data.cor <- cor(county.Demo_and_Covid.allcounties[,-1], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
data.cor2 <- cor(county.Demo_and_Covid.500counties[,-c(1:2)], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor2, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
corrplot.mixed(data.cor2[7:13,c(1:5, 14:42,6)], upper = 'ellipse', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)", data = county.Demo_and_Covid.500counties)
## Warning: Some predictor variables are on very different scales: consider rescaling
## Warning: Some predictor variables are on very different scales: consider rescaling
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula:
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)"
## Data: county.Demo_and_Covid.500counties
##
## REML criterion at convergence: -1279.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.4476 -0.3643 -0.0450 0.2751 5.6591
##
## Random effects:
## Groups Name Variance Std.Dev.
## stateID (Intercept) 0.000005991 0.002448
## Residual 0.000016393 0.004049
## Number of obs: 194, groups: stateID, 36
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) -0.0115884030 0.0117882119 102.1714073461 -0.983 0.32790
## Affluence 0.0048572736 0.0012086795 145.9882906560 4.019 0.0000934 ***
## Singletons.in.Tract 0.0007972993 0.0010280158 173.9883175327 0.776 0.43906
## Seniors.in.Tract 0.0003705353 0.0013375797 173.8297779448 0.277 0.78209
## African.Americans.in.Tract 0.0012952375 0.0011350952 173.9858959987 1.141 0.25540
## Noncitizens.in.Tract 0.0019481590 0.0008734959 154.8485408446 2.230 0.02717 *
## High.BP -0.0000146140 0.0002157771 156.8386378619 -0.068 0.94609
## Binge.Drinking 0.0003763401 0.0002027749 71.9248587706 1.856 0.06756 .
## Cancer -0.0020628884 0.0012863753 148.1133689421 -1.604 0.11092
## Asthma 0.0001851043 0.0006857686 75.7721139309 0.270 0.78795
## Heart.Disease 0.0029840602 0.0016148249 125.2874229164 1.848 0.06697 .
## COPD -0.0001941847 0.0013152651 123.5319841418 -0.148 0.88287
## Smoking -0.0001881992 0.0002679650 139.4046353248 -0.702 0.48365
## Diabetes -0.0007106649 0.0006504360 125.1596153064 -1.093 0.27667
## No.Physical.Activity -0.0000048944 0.0002504108 139.7365700433 -0.020 0.98443
## Obesity 0.0003820868 0.0002062908 162.9711384434 1.852 0.06581 .
## Poor.Sleeping.Habits 0.0000808121 0.0001866750 160.9656717266 0.433 0.66566
## Poor.Mental.Health -0.0000278398 0.0005481916 51.8871521283 -0.051 0.95969
## Testing_Rate 0.0000007057 0.0000002519 45.5746772564 2.802 0.00743 **
## Hospitalization_Rate -0.0001502398 0.0001139297 33.2027587657 -1.319 0.19629
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of fixed effects could have been required in summary()
##
## Correlation of Fixed Effects:
## (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer Asthma Hrt.Ds COPD Smokng Diabts N.Ph.A
## Affluence 0.025
## Sngltns.n.T 0.016 0.076
## Snrs.n.Trct 0.484 0.346 0.192
## Afrcn.Am..T 0.129 0.140 -0.388 0.143
## Nnctzns.n.T 0.009 0.120 0.040 0.091 -0.127
## High.BP -0.075 0.256 0.019 0.067 -0.073 0.344
## Bing.Drnkng -0.413 -0.112 -0.285 -0.116 0.073 -0.012 0.142
## Cancer -0.550 -0.110 0.219 -0.253 -0.082 -0.091 -0.341 -0.048
## Asthma -0.401 -0.106 -0.264 -0.211 0.077 0.089 0.116 0.053 0.025
## Heart.Dises -0.176 0.050 -0.310 -0.181 0.249 -0.139 0.053 0.080 -0.497 0.323
## COPD 0.569 0.024 0.156 0.276 -0.036 0.257 0.077 0.008 -0.244 -0.401 -0.580
## Smoking -0.108 0.109 -0.178 -0.125 -0.047 0.066 -0.033 -0.284 0.085 0.115 0.179 -0.477
## Diabetes 0.140 -0.376 -0.092 -0.189 -0.299 -0.235 -0.549 0.017 0.245 -0.133 -0.351 -0.010 0.213
## N.Physcl.Ac -0.210 0.076 0.111 0.020 -0.018 -0.217 -0.008 0.127 0.445 0.065 -0.350 -0.011 -0.292 -0.166
## Obesity -0.021 0.381 0.479 0.286 0.104 0.166 -0.102 -0.188 0.122 -0.214 -0.095 0.156 -0.257 -0.370 -0.002
## Pr.Slpng.Hb -0.411 -0.396 0.114 -0.326 -0.281 -0.070 -0.185 0.105 0.094 0.083 0.258 -0.162 -0.069 -0.034 -0.160
## Pr.Mntl.Hlt -0.353 0.211 -0.046 -0.041 0.061 -0.135 0.010 0.150 0.339 -0.283 0.064 -0.434 0.030 0.016 0.003
## Testing_Rat 0.211 -0.148 0.016 0.012 0.019 -0.011 -0.038 -0.095 -0.149 -0.280 -0.083 0.226 0.088 0.146 -0.322
## Hsptlztn_Rt -0.114 -0.161 -0.071 -0.198 -0.042 -0.111 -0.039 -0.037 -0.066 0.043 0.165 -0.125 0.084 0.000 -0.013
## Obesty Pr.S.H Pr.M.H Tstn_R
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises
## COPD
## Smoking
## Diabetes
## N.Physcl.Ac
## Obesity
## Pr.Slpng.Hb -0.135
## Pr.Mntl.Hlt 0.024 -0.134
## Testing_Rat 0.068 -0.101 -0.110
## Hsptlztn_Rt -0.022 0.021 -0.098 0.017
## fit warnings:
## Some predictor variables are on very different scales: consider rescaling
this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + (1 | stateID)", data = county.Demo_and_Covid.500counties)
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula:
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + (1 | stateID)"
## Data: county.Demo_and_Covid.500counties
##
## REML criterion at convergence: -2363.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6364 -0.4233 -0.0668 0.2641 5.8947
##
## Random effects:
## Groups Name Variance Std.Dev.
## stateID (Intercept) 0.000008614 0.002935
## Residual 0.000016525 0.004065
## Number of obs: 326, groups: stateID, 51
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) -0.02355677 0.00894220 185.52861745 -2.634 0.00914 **
## Affluence 0.00353587 0.00082102 299.26720942 4.307 0.0000225 ***
## Singletons.in.Tract 0.00078834 0.00077058 302.90953823 1.023 0.30710
## Seniors.in.Tract 0.00185062 0.00097258 305.44977771 1.903 0.05801 .
## African.Americans.in.Tract 0.00217267 0.00093933 307.47494207 2.313 0.02138 *
## Noncitizens.in.Tract 0.00238237 0.00075199 264.13116021 3.168 0.00171 **
## High.BP 0.00003585 0.00016929 294.09049667 0.212 0.83245
## Binge.Drinking 0.00054048 0.00017540 148.87386758 3.081 0.00246 **
## Cancer -0.00106029 0.00098913 258.40182242 -1.072 0.28475
## Asthma 0.00053173 0.00058024 133.64979796 0.916 0.36111
## Heart.Disease 0.00379611 0.00126243 197.52438876 3.007 0.00298 **
## COPD -0.00156562 0.00095524 193.32184495 -1.639 0.10284
## Smoking -0.00002189 0.00022171 238.21728134 -0.099 0.92142
## Diabetes -0.00150209 0.00047601 260.47025371 -3.156 0.00179 **
## No.Physical.Activity 0.00028534 0.00019064 226.50751025 1.497 0.13584
## Obesity 0.00033816 0.00015592 307.86546717 2.169 0.03086 *
## Poor.Sleeping.Habits 0.00025361 0.00014960 294.29424311 1.695 0.09109 .
## Poor.Mental.Health -0.00021496 0.00048954 98.55011067 -0.439 0.66155
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of fixed effects could have been required in summary()
##
## Correlation of Fixed Effects:
## (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer Asthma Hrt.Ds COPD Smokng Diabts N.Ph.A
## Affluence -0.038
## Sngltns.n.T -0.061 0.046
## Snrs.n.Trct 0.406 0.292 0.074
## Afrcn.Am..T 0.245 0.075 -0.406 0.200
## Nnctzns.n.T -0.072 0.153 0.127 0.056 -0.185
## High.BP -0.098 0.155 0.100 0.006 -0.240 0.335
## Bing.Drnkng -0.479 -0.051 -0.208 -0.074 0.042 -0.076 0.151
## Cancer -0.498 -0.097 0.231 -0.179 -0.071 -0.071 -0.327 -0.026
## Asthma -0.262 -0.104 -0.262 -0.118 -0.006 0.207 0.061 0.002 -0.160
## Heart.Dises -0.054 0.070 -0.298 -0.131 0.212 -0.051 -0.009 0.035 -0.600 0.338
## COPD 0.479 0.019 0.123 0.176 -0.001 0.155 0.064 0.065 -0.217 -0.327 -0.485
## Smoking -0.051 0.105 -0.118 -0.135 -0.107 0.161 -0.082 -0.326 0.162 0.145 0.078 -0.477
## Diabetes 0.035 -0.297 -0.082 -0.135 -0.230 -0.262 -0.441 0.075 0.360 -0.106 -0.424 -0.018 0.281
## N.Physcl.Ac -0.113 0.031 0.099 0.079 0.060 -0.273 0.003 0.119 0.342 -0.028 -0.365 0.086 -0.274 -0.169
## Obesity -0.064 0.387 0.398 0.206 0.135 0.198 -0.104 -0.154 0.120 -0.133 -0.023 0.094 -0.221 -0.379 -0.048
## Pr.Slpng.Hb -0.388 -0.357 0.164 -0.330 -0.325 -0.044 -0.156 0.087 0.030 -0.001 0.242 -0.097 -0.160 -0.058 -0.156
## Pr.Mntl.Hlt -0.356 0.181 -0.004 0.011 0.046 -0.169 0.020 0.132 0.419 -0.433 -0.070 -0.386 -0.025 0.075 -0.075
## Obesty Pr.S.H
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises
## COPD
## Smoking
## Diabetes
## N.Physcl.Ac
## Obesity
## Pr.Slpng.Hb -0.116
## Pr.Mntl.Hlt 0.030 -0.087
testing.data.state <- compiled.stats[[length(daily_filenames)]][, c("Province_State", "Testing_Rate")]
testing.data.state <- testing.data.state[!is.na(testing.data.state$Testing_Rate),]
testing.data.state <- testing.data.state[order(testing.data.state$Testing_Rate),]
col.state <- rep("pink", nrow(testing.data.state))
avg.test.rate <- mean(testing.data.state$Testing_Rate, na.rm = T)
col.state[testing.data.state$Testing_Rate < avg.test.rate] <- "grey"
col.state[testing.data.state$Province_State == "Oklahoma"] <- "lightblue"
par(mar = c(5,6,4,2))
barplot(testing.data.state$Testing_Rate, names.arg = testing.data.state$Province_State, horiz = T, main = "Testing Rate by State", las = 2, cex.axis = 1, cex.names = 0.5, col = col.state, border = F, xlab = "Total number of people tested per 100,000 persons.")
abline(v = avg.test.rate, col = "red")
text(x = avg.test.rate + 10, y = 1, labels = "Average Testing Rate", adj = c(0, 0.5), col = "red")
Pink highlights the last 14 days.
day.first.case <- min(which(US.total$cases.total > 100))
n.days <- nrow(US.total)
twoweek.col <- c(rep("grey", n.days-day.first.case-13), rep("pink", 14))
par(mar = c(5,5,4,2))
barplot(US.total$cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 cases by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 cases by Date in US, log scale",
las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
col = twoweek.col, border = F)
barplot(US.total$deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 deaths by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 deaths by Date in US, log scale",
las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
col = twoweek.col, border = F)
barplot(US.total$rise.cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Rise in Cases of COVID-19 by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$rise.deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Rise in Deaths of COVID-19 by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)